package com.starnet.studentmanagement.vo;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

@Data
public class PageResult {
    //状态码
    private Integer code;
    //提示消息
    private String msg;
    //数据部分
    private Object data;
    //分页信息
    private PageVO pageVO;

    public PageResult(Integer code, String msg, Object data, PageVO pageVO) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.pageVO = pageVO;
    }

    public PageResult(ResultCode resultCode, Object data, PageVO pageVO) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
        this.data = data;
        this.pageVO = pageVO;
    }

    public static PageResult success(Object data, PageVO pageVO) {
        return new PageResult(ResultCode.SUCCESS, data, pageVO);
    }
}
